import { createSelector, createFeatureSelector } from '@ngrx/store';
import { StoreModule, ActionReducerMap } from '@ngrx/store';
const initialState = true;

export function featureAReducer(state: boolean = initialState, action: any) {
  switch (action.type) {
    case 'ASIDE_IS_COLLAPSE': {
      //console.log('true',state,action)
      //state = action.payload
      return true;
    }

    case 'ASIDE_NOT_COLLAPSE': {
      //console.log('true',state,action)
      return false;
    }
    default: {
      return state;
    }
  }
}
export const reducers: ActionReducerMap<any> = {
  store: featureAReducer,
};
export interface FeatureState {
  isCollapse: boolean;
}

export const AppState = {
  feature: featureBReducer
};

export function featureBReducer(state: boolean = initialState, action: any) {
  switch (action.type) {
    case 'ASIDE_IS_COLLAPSE': {
      //console.log('true',state,action)
      //state = action.payload
      return true;
    }

    case 'ASIDE_NOT_COLLAPSE': {
      //console.log('true',state,action)
      return false;
    }
    default: {
      return state;
    }
  }
}
export const selectCollapse = createFeatureSelector<FeatureState>('store');
export const getCollapse = createSelector(selectCollapse,(state: FeatureState) => state.isCollapse);

/*
export interface FeatureState {
  counter: number;
}

export interface AppState {
  feature: State
}

export const selectFeature = createFeatureSelector<FeatureState>('feature');
export const selectFeatureCount = createSelector(selectFeature, (state: FeatureState) => state.counter);*/
